home *** CD-ROM | disk | FTP | other *** search
/ The Guided Tour of Multimedia (Second Edition) / The Guided Tour of Multimedia (Second Edition).iso / trials / oimdemo / setup / oimdemo.mst < prev    next >
Text File  |  1995-07-10  |  29KB  |  845 lines

  1. ''
  2. '' Open!Info Manager Setup Script.
  3. ''
  4. ''
  5.  
  6.  
  7. '$DEFINE DEBUG          ''Define for script development/debugging
  8.  
  9. ''
  10. '' Required includes to interface with MSSETUP DLL's
  11. '' -------------------------------------------------
  12. '$INCLUDE 'setupapi.inc'
  13. '$INCLUDE 'msdetect.inc'
  14.  
  15.  
  16.  
  17. ''
  18. '' Dialog box id's
  19. '' ---------------
  20. CONST WELCOME        = 100
  21. CONST DEST_PATH_DLG  = 300
  22. CONST EXITQUIT       = 600          '' Exits on user request
  23. CONST EXITSUCCESS    = 700          '' Exits when install is done
  24. CONST HELP_DLG       = 0            '' The help dialog.
  25. CONST WAIT_DLG       = 2100         '' Wait message.
  26. CONST RESTART        = 2600
  27. CONST RESTARTII      = 2700
  28. CONST INSTALL_DLG    = 6200         '' Custom Install Dialog.
  29. CONST TOOBIG         = 6300         '' Not enough space on target disk error
  30. CONST BADPATH        = 6400         '' Bad destination path error
  31. CONST BADWINDOWS     = 6500         '' Wrong Windows release
  32. CONST EXITFAILURE    = 6600         '' Exits on error
  33.  
  34. ''
  35. '' String id's
  36. '' -----------
  37. CONST STR_GROUP      = "HTI Open!Info Demo"
  38. CONST STR_MPLAYER    = "Media Player"
  39. CONST STR_OIM        = "Open!Info Manager"
  40. CONST STR_OIR        = "Open!Info Reader"
  41. CONST STR_README     = "Read Me"
  42.  
  43. ''
  44. '' Miscellaneous Constants
  45. '' -----------------------
  46. CONST NOLOGO         = 1            '' Dummy NULL bitmap (must be 1)
  47. CONST LOGO           = 2            '' Background bitmap
  48.  
  49. CONST INSTALLFAILED  = 0            '' Install failed for some reason
  50. CONST INSTALLOK      = 1            '' Install completed OK
  51.  
  52. CONST MAX_PATH_STR   = 26           '' Maximum path allowed in DBVISTA
  53. CONST MAX_CHARS      = 35           '' Maximum path to display.
  54.  
  55. CONST WINDOW_TITLE   = "Open!Info Manager Demo Setup"
  56. CONST PATH_MSG       = "The path string length must be less than 27 characters."
  57. CONST ANALYZE_MSG    = "We need to analyze your video system to ensure maximum performance.  This may take several minutes."
  58. CONST RESTART_MSG    = "You need to restart windows before running Open!Info Manager Demo software."
  59.  
  60. ''
  61. '' Custom Install Dialog Option CheckBox Ids
  62. '' -----------------------------------------
  63. CONST APP_CB         = 1
  64. CONST DEMO_CB        = 2
  65. CONST LAST_CB        = 2
  66.  
  67. ''
  68. '' Paths and directory strings
  69. '' ---------------------------
  70. CONST OIM_DIR        = "\OIMDEMO"
  71. CONST BIN_DIR        = "\BIN"
  72. CONST MB_DIR         = "\MB"
  73. CONST BACKUP_DIR     = "\BACKUP"
  74. CONST TEXT_DIR       = "\MEDIA\TEXT"
  75. CONST IMAGE_DIR      = "\MEDIA\IMAGE"
  76. CONST PLAY_DIR       = "\MEDIA\PLAYABLE"
  77. CONST DEMO_DIR       = "\DEMO"
  78. CONST VFWTMS_DIR     = "SETUP\VFWTMS\"
  79.  
  80. ''
  81. '' Various file names
  82. '' ------------------
  83. CONST OIM_INI_NAME   = "oim.ini"
  84. CONST OIR_INI_NAME   = "oir.ini"
  85. CONST OIM_NAME       = "oim.exe"
  86. CONST OIR_NAME       = "oir.exe"
  87. CONST INF_FILE_NAME  = "setup\oimdemo.inf"
  88.  
  89. CONST HELP_PROC      = ""
  90.  
  91. ''
  92. '' INF file section names
  93. '' ----------------------
  94. CONST PROGRAM_SECT   = "Program Files"
  95. CONST DATABASE_SECT  = "Database Files"
  96. CONST BACKUP_SECT    = "Backup Files"
  97. CONST DEMO_SECT      = "Demo Files"
  98. CONST MPLAYER_SECT   = "Media Player Files"
  99. CONST VFW_SECT       = "VfW Files"
  100. CONST WING_SECT      = "WinG Files"
  101. CONST TMS_SECT       = "TrueMotion-S Files"
  102.  
  103.  
  104.  
  105. ''
  106. '' Global Variables
  107. '' ----------------
  108. GLOBAL DstDir$                      '' Default destination directory.
  109. GLOBAL SrcDir$                      '' Source directory
  110. GLOBAL WinSysDir$                   '' Windows System directory.
  111. GLOBAL WinDir$                      '' Windows directory.
  112. GLOBAL WinDrive$                    '' Windows drive letter.
  113. GLOBAL ExtraCosts$                  '' List of extra costs to add per drive
  114. GLOBAL AppNeeds$                    '' Disk space costs per drive for application.
  115. GLOBAL Opt2Needs$                   '' Option list costs per drive for demo files.
  116. GLOBAL Opt3Needs$                   '' Option list costs per drive for sample files.
  117. GLOBAL Opt4Needs$                   '' Option list costs per drive for qtw files.
  118. GLOBAL Success%                     '' Installation completion code
  119. GLOBAL EnableStatus%                '' 3D control status.
  120.  
  121. GLOBAL DRIVELIST$                   '' List of drives.
  122. GLOBAL LISTBOX$                     '' List of drives to display in list box.
  123. GLOBAL LISTSELECT$                  '' Drive list selection.
  124.  
  125. GLOBAL CUIDLL$                      '' User interface DLL
  126.  
  127. GLOBAL CHECKSTATES$
  128. GLOBAL STATUSTEXT$
  129. GLOBAL DRIVETEXT$
  130.  
  131.  
  132.  
  133. ''
  134. '' Subroutines and Functions
  135. '' -------------------------
  136. DECLARE FUNCTION StartCustomSetup          LIB "setupenu.dll" (hinst%, hwnd%) AS INTEGER
  137. DECLARE FUNCTION StopCustomSetup           LIB "setupenu.dll" (hinst%, hwnd%) AS INTEGER
  138. DECLARE FUNCTION WritePrivateProfileString LIB "krnl386.exe" (szSect$, szEntry$, szString$, szINI$) AS INTEGER
  139. DECLARE FUNCTION OnWindowsNT               LIB "iniupd.dll" AS INTEGER
  140. DECLARE FUNCTION VflatdPresent             LIB "iniupd.dll" AS INTEGER
  141. DECLARE FUNCTION ExitWindowsExec           LIB "user" (Exec$, Param$) AS INTEGER
  142. DECLARE FUNCTION ctl3dRegister             LIB "ctl3d.dll" (hinst%) AS INTEGER
  143. DECLARE FUNCTION ctl3dAutoSubclass         LIB "ctl3d.dll" (hinst%) AS INTEGER
  144. DECLARE FUNCTION Ctl3dUnregister           LIB "ctl3d.dll" (hinst%) AS INTEGER
  145.  
  146.  
  147.  
  148. ''
  149. '' Local subroutines
  150. '' -----------------
  151. DECLARE FUNCTION Install AS INTEGER
  152. DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
  153. DECLARE FUNCTION RemoveOldQTFiles (DeadPath$) AS INTEGER
  154. DECLARE SUB AddOptFilesToCopyList (Option%)
  155. DECLARE SUB EnableCtl3D (Enable%)
  156. DECLARE SUB RecalcPath (Option%)
  157. DECLARE SUB SetDriveStatus
  158.  
  159.  
  160.  
  161. INIT:
  162.    ''
  163.    '' Initialize global vriables
  164.    '' --------------------------
  165.    WinSysDir$     = GetWindowsSysDir
  166.    WinDir$        = GetWindowsDir
  167.    Success%       = INSTALLFAILED
  168.    CUIDLL$        = "setupenu.dll"
  169.    AppNeeds$      = "AppNeeds"
  170.    Opt2Needs$     = "Opt2Needs"
  171.    Opt3Needs$     = "Opt3Needs"
  172.    Opt4Needs$     = "Opt4Needs"
  173.    ExtraCosts$    = "ExtraCosts"
  174.  
  175.    ''
  176.    '' Get the Source path and remove the last "\" char
  177.    '' ------------------------------------------------
  178.    TempDir$ = GetSymbolValue("STF_SRCDIR")
  179.    SrcDir$  = MID$(TempDir$, 1, LEN(TempDir$) - 1)
  180.    TempDir$ = ""
  181.  
  182.    ''
  183.    '' Initialize custom setup logic
  184.    '' -----------------------------
  185.    SetTitle WINDOW_TITLE
  186.    i% = StartCustomSetup (HinstFrame(), HwndFrame ())
  187.    i% = SetBeepingMode(1)
  188.  
  189.    ''
  190.    '' Copy the 3D control dll to the windows system to enable the
  191.    '' 3D look and feel of dialogs.
  192.    '' -----------------------------------------------------------
  193.    CopyFile SrcDir$ + "\setup\ctl3dv2.dll", WinSysDir$ + "ctl3dv2.dll", cmoOverwrite, 0
  194.  
  195.    ''
  196.    '' Make sure that we are running on Windows 3.1 or better
  197.    '' ------------------------------------------------------
  198.    IF GetWindowsMajorVersion() < 3 THEN
  199.       EnableCtl3D 1
  200.       sz$ = UIStartDlg(CUIDLL$, BADWINDOWS, "FInfo0DlgProc", HELP_DLG, HELP_PROC)
  201.       UIPop 1
  202.       GOTO CLEANUP
  203.    END IF
  204.  
  205.    IF (GetWindowsMajorVersion() = 3) AND (GetWindowsMinorVersion() < 10) THEN
  206.       EnableCtl3D 1
  207.       sz$ = UIStartDlg(CUIDLL$, BADWINDOWS, "FInfo0DlgProc", HELP_DLG, HELP_PROC)
  208.       UIPop 1
  209.       GOTO CLEANUP
  210.    END IF
  211.  
  212.    ''
  213.    '' Make sure that we are running on a 386 or better
  214.    '' ------------------------------------------------
  215.    IF GetProcessorType() < 3 THEN
  216.       EnableCtl3D 1
  217.       sz$ = UIStartDlg(CUIDLL$, BADWINDOWS, "FInfo0DlgProc", HELP_DLG, HELP_PROC)
  218.       UIPop 1
  219.       GOTO CLEANUP
  220.    END IF
  221.  
  222.    ''
  223.    '' Use Wowexec to determine version of NT.  3.1 did not stamp
  224.    '' wowexec and wow returns 3.1 as version
  225.    '' ----------------------------------------------------------
  226.    IF OnWindowsNT() THEN
  227.       EnableCtl3D 1
  228.       sz$ = UIStartDlg(CUIDLL$, BADWINDOWS, "FInfo0DlgProc", HELP_DLG, HELP_PROC)
  229.       UIPop 1
  230.       GOTO CLEANUP
  231.    END IF
  232.  
  233.    ''
  234.    '' Setup the custom install dialog symbols
  235.    '' ---------------------------------------
  236.    AddListItem ExtraCosts$, ""
  237.    AddListItem ExtraCosts$, ""
  238.    FOR i% = 1 TO 26 STEP 1
  239.       AddListItem ExtraCosts$, "16384"
  240.    NEXT i%
  241.  
  242.    ''
  243.    '' default dest to first hard drive
  244.    '' since some OEM systems don't start at C:
  245.    '' ----------------------------------------
  246.    GetLocalHardDrivesList "HardDrives"
  247.    NumDrives% = GetListLength("HardDrives")
  248.  
  249.    WinDrive$ = MID$(WinDir$, 1, 1)
  250.    DstDir$ = WinDrive$ + ":" + OIM_DIR
  251.  
  252.    CHECKSTATES$ = "CheckItemsState"
  253.    STATUSTEXT$  = "StatusItemsText"
  254.    DRIVETEXT$   = "DriveStatusText"
  255.  
  256.    FOR i% = 1 TO LAST_CB STEP 1
  257.       AddListItem CHECKSTATES$, "OFF"
  258.    NEXT i%
  259.    ReplaceListItem CHECKSTATES$, 1, "ON"
  260.  
  261.    FOR i% = 1 TO LAST_CB STEP 1
  262.       AddListItem STATUSTEXT$, ""
  263.    NEXT i%
  264.  
  265.    FOR i% = 1 TO 7 STEP 1
  266.       AddListItem DRIVETEXT$, ""
  267.    NEXT i%
  268.    ReplaceListItem DRIVETEXT$, 7, DstDir$
  269.  
  270.    ''
  271.    '' Read the INF file
  272.    '' -----------------
  273.    szInf$ = GetSymbolValue("STF_SRCINFPATH")
  274.  
  275.    IF szInf$ = "" THEN
  276.       szTemp$ = GetSymbolValue("STF_SRCDIR")
  277.       SPLITPATH szTemp$, drv$, dir$, filename$, ext$
  278.       szInf$ = szTemp$ + INF_FILE_NAME
  279.    END IF
  280.  
  281.    ReadInfFile szInf$
  282.  
  283.    EnableCtl3D 1
  284. WELCOME:
  285.    sz$ = UIStartDlg(CUIDLL$, WELCOME, "FInfoDlgProc", HELP_DLG, HELP_PROC)
  286.    IF sz$ = "CONTINUE" THEN
  287.       UIPop 1
  288.       EnableCtl3D 0
  289.    ELSE
  290.       GOSUB ASKQUIT
  291.       GOTO WELCOME
  292.    END IF
  293.  
  294.  
  295.    ''
  296.    '' Calculate the disk space required
  297.    '' ---------------------------------
  298. ''   EnableCtl3D 1
  299. ''   sz$ = UIStartDlg(CUIDLL$, WAIT_DLG, "FModelessDlgProc", HELP_DLG, HELP_PROC)
  300. ''   FOR i% = 1 TO LAST_CB STEP 1
  301. ''      RecalcPath i%
  302. ''   NEXT i%
  303. ''   SetDriveStatus
  304. ''   UIPop 1
  305. ''   EnableCtl3D 0
  306.  
  307.  
  308.    GOTO GETPATH
  309.  
  310. ''
  311. '' Perform actual installation
  312. '' ---------------------------
  313. INSTALLER:
  314.    Success% = Install
  315.  
  316.    ''
  317.    '' Create a Program Manager group
  318.    '' ------------------------------
  319.    IF GetListItem(CHECKSTATES$, APP_CB) = "ON" AND Success% = INSTALLOK THEN
  320.       ''
  321.       '' Create the needed directories
  322.       '' -----------------------------
  323.       IF DoesDirExist(DstDir$ + TEXT_DIR) = 0 THEN
  324.          CreateDir DstDir$ + TEXT_DIR, cmoNone
  325.       END IF
  326.       IF DoesDirExist(DstDir$ + IMAGE_DIR) = 0 THEN
  327.          CreateDir DstDir$ + IMAGE_DIR, cmoNone
  328.       END IF
  329.       IF DoesDirExist(DstDir$ + PLAY_DIR) = 0 THEN
  330.          CreateDir DstDir$ + PLAY_DIR, cmoNone
  331.       END IF
  332.  
  333.       CreateProgmanGroup STR_GROUP, "", cmoNone
  334.  
  335.       CreateProgmanItem STR_GROUP, STR_OIM, DstDir$ + BIN_DIR + "\" + OIM_NAME, ""+DstDir$+BIN_DIR+"\"+OIM_NAME+",0,,,"+DstDir$+BIN_DIR+"\", cmoOverwrite
  336.       CreateProgmanItem STR_GROUP, STR_OIR, DstDir$ + BIN_DIR + "\" + OIR_NAME, ""+DstDir$+BIN_DIR+"\"+OIR_NAME+",0,,,"+DstDir$+BIN_DIR+"\", cmoOverwrite
  337.       CreateProgmanItem STR_GROUP, STR_README, WinDir$ + "write.exe " + DstDir$ + "\readme.wri", "", cmoOverwrite
  338.       CreateProgmanItem "Accessories", STR_MPLAYER, WinDir$ + "mplayer.exe", "", cmoOverwrite
  339.  
  340.       ''
  341.       '' Create the OIR.INI file
  342.       '' -----------------------
  343.       GOSUB CREATEINI
  344.       i% = DoMsgBox(RESTART_MSG, WINDOW_TITLE, MB_OK + MB_TASKMODAL + MB_ICONINFORMATION)
  345.    END IF
  346.  
  347.  
  348. ''
  349. '' When done, issue dialog
  350. '' -----------------------
  351. QUIT:
  352.    EnableCtl3D 1
  353.    IF Success% = INSTALLOK THEN
  354.       sz$ = UIStartDlg(CUIDLL$, EXITSUCCESS, "FInfo0DlgProc", HELP_DLG, HELP_PROC)
  355.    ELSE
  356.       sz$ = UIStartDlg(CUIDLL$, EXITFAILURE, "FInfo0DlgProc", HELP_DLG, HELP_PROC)
  357.    END IF
  358.    UIPop 1
  359.  
  360.  
  361. ''
  362. '' Clean up all processing
  363. '' -----------------------
  364. CLEANUP:
  365.    EnableCtl3D 0
  366.    i% = StopCustomSetup (HinstFrame(), HwndFrame ())
  367.    END
  368.  
  369.  
  370. ''
  371. '' ASKQUIT: The user requested quit; does (s)he really want to?
  372. '' ------------------------------------------------------------
  373. ASKQUIT:
  374.    sz$ = UIStartDlg(CUIDLL$, EXITQUIT, "FInfoDlgProc", HELP_DLG, HELP_PROC)
  375.    UIPop 1
  376.    IF sz$ = "CONTINUE" THEN
  377.       RETURN
  378.    END IF
  379.    GOTO CLEANUP
  380.  
  381.  
  382. ''
  383. '' BADPATH: The user entered an invalid destination directory
  384. '' ----------------------------------------------------------
  385. BADPATH:
  386.    sz$ = UIStartDlg(CUIDLL$, BADPATH, "FInfo0DlgProc", HELP_DLG, HELP_PROC)
  387.    IF sz$ = "REACTIVATE" THEN
  388.       GOTO BADPATH
  389.    END IF
  390.    UIPop 1
  391.  
  392.    RETURN
  393.  
  394.  
  395. ''
  396. '' GETPATH: Get the destination directory for the product
  397. '' ------------------------------------------------------
  398. GETPATH:
  399.    EnableCtl3D 1
  400.    SetSymbolValue "EditTextIn", DstDir$
  401.    SetSymbolValue "EditFocus", "END"
  402. GETPATHL1:
  403.    sz$ = UIStartDlg(CUIDLL$, DEST_PATH_DLG, "FEditDlgProc", HELP_DLG, HELP_PROC)
  404.  
  405.    IF sz$ = "CONTINUE" THEN
  406.       
  407.       DstDir$ = GetSymbolValue("EditTextOut")
  408.  
  409.       ''
  410.       '' Truncate display if too long
  411.       '' ----------------------------
  412.       DestPathLen% = LEN(DstDir$)
  413.       IF DestPathLen% > MAX_PATH_STR THEN
  414.          i% = DoMsgBox(PATH_MSG, WINDOW_TITLE, MB_OK + MB_TASKMODAL + MB_ICONHAND)
  415.          GOTO GETPATHL1
  416.       ELSE
  417.          IF DestPathLen% > MAX_CHARS THEN
  418.             ReplaceListItem DRIVETEXT$, 7, "..." + MID$(DstDir$, DestPathLen% - MAX_CHARS, MAX_CHARS)
  419.          ELSE
  420.             ReplaceListItem DRIVETEXT$, 7, DstDir$
  421.          END IF
  422.       END IF
  423.  
  424.       RecalcPath APP_CB
  425.       SetDriveStatus
  426.  
  427.       ''
  428.       ''Install only if it will fit
  429.       '' --------------------------
  430.       IF VAL(GetListItem(DRIVETEXT$, 2)) >= VAL(GetListItem(DRIVETEXT$, 3)) THEN
  431.          GOSUB TOOBIG
  432.          GOTO GETPATHL1
  433.       END IF
  434.       UIPop 1
  435.       EnableCtl3D 0
  436.       GOTO INSTALLER
  437.  
  438.    ELSEIF sz$ = "REACTIVATE" THEN
  439.       GOTO GETPATHL1
  440.    ELSEIF sz$ = "EXIT" THEN
  441.       GOSUB ASKQUIT
  442.       GOTO GETPATHL1
  443.    ELSE
  444.       UIPop 1
  445.       GOTO GETPATHL1
  446.    END IF
  447.  
  448.  
  449. ''
  450. '' TOOBIG: The source files won't fit on the requested destination disk
  451. '' --------------------------------------------------------------------
  452. TOOBIG:
  453.    sz$ = UIStartDlg(CUIDLL$, TOOBIG, "FInfo0DlgProc", HELP_DLG, HELP_PROC)
  454.    IF sz$ = "REACTIVATE" THEN
  455.       GOTO TOOBIG
  456.    END IF
  457.    UIPop 1
  458.  
  459.    RETURN
  460.  
  461.  
  462. ''
  463. '' Create the INI files
  464. '' --------------------
  465. CREATEINI:
  466.    IF GetListItem(CHECKSTATES$, APP_CB) = "OFF" THEN
  467.       RETURN
  468.    END IF
  469.  
  470.    ''
  471.    '' Create the Open!Info Reader INI file
  472.    '' ------------------------------------
  473.    IniFile$ = DstDir$ + BIN_DIR + "\" + OIR_INI_NAME
  474.  
  475.    CreateIniKeyValue IniFile$, "Paths", "BinPath",      DstDir$ + BIN_DIR, cmoOverwrite
  476.    CreateIniKeyValue IniFile$, "Paths", "DatabasePath", DstDir$ + MB_DIR,  cmoOverwrite
  477.  
  478.    IF (GetListItem(CHECKSTATES$, DEMO_CB) = "ON") THEN
  479.       TextDir$  = DstDir$ + TEXT_DIR
  480.       ImageDir$ = DstDir$ + IMAGE_DIR
  481.       PlayDir$  = DstDir$ + PLAY_DIR
  482.    ELSE
  483.       TextDir$  = DstDir$ + TEXT_DIR  + ";" + SrcDir$ + TEXT_DIR
  484.       ImageDir$ = DstDir$ + IMAGE_DIR + ";" + SrcDir$ + IMAGE_DIR
  485.       PlayDir$  = DstDir$ + PLAY_DIR  + ";" + SrcDir$ + PLAY_DIR
  486.    END IF
  487.  
  488.    CreateIniKeyValue IniFile$, "Paths", "TextPath",      TextDir$,  cmoOverwrite
  489.    CreateIniKeyValue IniFile$, "Paths", "ImagePath",     ImageDir$, cmoOverwrite
  490.    CreateIniKeyValue IniFile$, "Paths", "AnimationPath", PlayDir$,  cmoOverwrite
  491.    CreateIniKeyValue IniFile$, "Paths", "SoundPath",     PlayDir$,  cmoOverwrite
  492.    CreateIniKeyValue IniFile$, "Paths", "VideoPath",     PlayDir$,  cmoOverwrite
  493.  
  494.    CreateIniKeyValue IniFile$, "Files", "DatabaseName",  "mb",                    cmoOverwrite
  495.    CreateIniKeyValue IniFile$, "Files", "ErrorsFile",    DstDir$ + "\ERRORS.TXT", cmoOverwrite
  496.  
  497.    ''
  498.    '' Create the Open!Info Manager INI file
  499.    '' -------------------------------------
  500.    OimIni$ = DstDir$ + BIN_DIR + "\" + OIM_INI_NAME
  501.    CopyFile IniFile$, OimIni$, cmoNone, 0
  502.    IniFile$ = OimIni$
  503.  
  504.    CreateIniKeyValue IniFile$, "Paths", "PubDataPath",        DstDir$ + MB_DIR  + "\INIT",         cmoOverwrite
  505.    CreateIniKeyValue IniFile$, "Paths", "PubSetupPath",       DstDir$ + BIN_DIR + "\INIT",         cmoOverwrite
  506.    CreateIniKeyValue IniFile$, "Paths", "PubVfwSetupPath",    DstDir$ + BIN_DIR + "\INIT\VFW",     cmoOverwrite
  507.    CreateIniKeyValue IniFile$, "Paths", "PubVfwTmsSetupPath", DstDir$ + BIN_DIR + "\INIT\VFWTMS",  cmoOverwrite
  508.    CreateIniKeyValue IniFile$, "Paths", "PubQtwSetupPath",    DstDir$ + BIN_DIR + "\INIT\QTW",     cmoOverwrite
  509.    CreateIniKeyValue IniFile$, "Paths", "PubQtwTmsSetupPath", DstDir$ + BIN_DIR + "\INIT\QTWTMS",  cmoOverwrite
  510.    CreateIniKeyValue IniFile$, "Paths", "BackupPath",         DstDir$ + "\BACKUP",                 cmoOverwrite
  511.    CreateIniKeyValue IniFile$, "Paths", "MediaPath",          DstDir$ + "\MEDIA",                  cmoOverwrite
  512.  
  513.    CreateIniKeyValue IniFile$, "Files", "DefaultBackupFile",  DstDir$ + "\BACKUP\EXPORTED.OIM",    cmoOverwrite
  514.  
  515.    CreateIniKeyValue IniFile$, "Default", "SelectionEffect",     "Flash", cmoOverwrite
  516.    CreateIniKeyValue IniFile$, "Default", "TypeMoveCtrl",        "Goto",  cmoOverwrite
  517.    CreateIniKeyValue IniFile$, "Default", "TypePlayerCtrl",      "Play",  cmoOverwrite
  518.    CreateIniKeyValue IniFile$, "Default", "TextAlignment",       "Left",  cmoOverwrite
  519.    CreateIniKeyValue IniFile$, "Default", "TextFontName",        "Arial", cmoOverwrite
  520.    CreateIniKeyValue IniFile$, "Default", "TextFontSize",        "37",    cmoOverwrite
  521.    CreateIniKeyValue IniFile$, "Default", "TextColor",           "0",     cmoOverwrite
  522.    CreateIniKeyValue IniFile$, "Default", "TextBold",            "0",     cmoOverwrite
  523.    CreateIniKeyValue IniFile$, "Default", "TextItalic",          "0",     cmoOverwrite
  524.    CreateIniKeyValue IniFile$, "Default", "TextUnderline",       "0",     cmoOverwrite
  525.    CreateIniKeyValue IniFile$, "Default", "TextStrikeOut",       "0",     cmoOverwrite
  526.    CreateIniKeyValue IniFile$, "Default", "TextBorder",          "0",     cmoOverwrite
  527.    CreateIniKeyValue IniFile$, "Default", "TextShadow",          "0",     cmoOverwrite
  528.    CreateIniKeyValue IniFile$, "Default", "LoopDisplay",         "0",     cmoOverwrite
  529.    CreateIniKeyValue IniFile$, "Default", "PresentationWidth",   "640",   cmoOverwrite
  530.    CreateIniKeyValue IniFile$, "Default", "PresentationHeight",  "480",   cmoOverwrite
  531.    CreateIniKeyValue IniFile$, "Default", "PresentationTitle",   "0",     cmoOverwrite
  532.    CreateIniKeyValue IniFile$, "Default", "AllowTextSearch",     "1",     cmoOverwrite
  533.    CreateIniKeyValue IniFile$, "Default", "ClearPageBackground", "0",     cmoOverwrite
  534.  
  535.    ''
  536.    '' Clear the local variables
  537.    '' -------------------------
  538.    IniFile$  = ""
  539.    OimIni$   = ""
  540.    TextDir$  = ""
  541.    ImageDir$ = ""
  542.    PlayDir$  = ""
  543.  
  544.    RETURN
  545.  
  546.  
  547. ''
  548. '' Install: Perform actual installation
  549. '' ------------------------------------
  550. FUNCTION Install STATIC AS INTEGER
  551.  
  552.    SrcDir2$ = SrcDir$ + "\"
  553.  
  554.    EnableCtl3D 1
  555.  
  556.    ''
  557.    '' Install the program files
  558.    '' -------------------------
  559.    IF GetListItem(CHECKSTATES$, APP_CB) = "ON" THEN
  560.       ClearCopyList
  561.  
  562.       AddSectionFilesToCopyList PROGRAM_SECT,  SrcDir2$, DstDir$
  563.       AddSectionFilesToCopyList DATABASE_SECT, SrcDir2$, DstDir$
  564.       AddSectionFilesToCopyList BACKUP_SECT,   SrcDir2$, DstDir$
  565.  
  566.       CopyFilesInCopyList
  567.    END IF
  568.  
  569.    ''
  570.    '' Install Demo Presentation Media Files
  571.    '' -------------------------------------
  572.    IF GetListItem(CHECKSTATES$, DEMO_CB) = "ON" THEN
  573.       ClearCopyList
  574.       AddSectionFilesToCopyList DEMO_SECT, SrcDir2$, DstDir$
  575.       CopyFilesInCopyList
  576.    END IF
  577.  
  578.  
  579.    ''
  580.    '' Install Video for Windoes
  581.    '' -------------------------
  582.    IF GetListItem(CHECKSTATES$, APP_CB) = "ON" THEN
  583.       ''
  584.       '' Detect if the graphics card is DCI enabled
  585.       '' ------------------------------------------
  586.       DCIProvider$ = ""
  587.       i% = DoesIniKeyExist(WinDir$ + "system.ini", "Drivers", "DCI")
  588.       IF i% <> 0 THEN
  589.          DCIProvider$ = GetIniKeyString(WinDir$ + "system.ini", "Drivers", "DCI")
  590.          IF (DCIProvider$ = "DCISVGA") OR (DCIProvider$ = "dcisvga") THEN
  591.             DCIProvider$ = ""
  592.          END IF
  593.       END IF
  594.       
  595.       ''
  596.       '' Prepare Copy list and check size
  597.       '' --------------------------------
  598.       ClearCopyList
  599.  
  600.       AddSectionFilesToCopyList MPLAYER_SECT,   SrcDir2$ + VFWTMS_DIR, WinDir$
  601.       AddSectionFilesToCopyList VFW_SECT,       SrcDir2$ + VFWTMS_DIR, WinSysDir$
  602.       AddSectionFilesToCopyList WING_SECT,      SrcDir2$ + VFWTMS_DIR, WinSysDir$
  603.       AddSectionFilesToCopyList TMS_SECT,       SrcDir2$ + VFWTMS_DIR, WinSysDir$
  604.  
  605.       SetRestartDir WinDir$
  606.       CopyFilesInCopyList
  607.  
  608.       ''
  609.       '' Updating WIN.INI and SYSTEM.INI
  610.       '' -------------------------------
  611.       IF VflatdPresent() = 0 THEN
  612.          CreateSysIniKeyValue WinDir$ + "system.ini", "386Enh", "device", "dva.386", cmoOverwrite
  613.       END IF
  614.  
  615.       CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "VIDC.CVID", "iccvid.drv", cmoOverwrite
  616.       CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "VIDC.MSVC", "msvidc.drv", cmoOverwrite
  617.       CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "VIDC.IV32", "ir32.dll", cmoOverwrite
  618.       CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "VIDC.IV31", "IR32.dll", cmoOverwrite
  619.       CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "VIDC.MRLE", "MSRLE.drv", cmoOverwrite
  620.       i% = DoesIniKeyExist(WinDir$ + "system.ini", "Drivers", "VIDC.RT21")
  621.       IF i% = 0  THEN
  622.          CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "VIDC.RT21", "ir21_r.dll", cmoOverwrite
  623.       END IF
  624.       CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "VIDC.YVU9", "ir21_r.dll", cmoOverwrite
  625.       CreateIniKeyValue WinDir$ + "WIN.INI", "mci extensions", "avi", "AVIVideo", cmoOverwrite
  626.       CreateIniKeyValue WinDir$ + "system.ini", "mci", "AVIVideo", "mciavi.drv", cmoOverwrite
  627.       CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "WaveMapper", "msacm.drv", cmoOverwrite
  628.       CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "MSACM.msadpcm", "msadpcm.acm", cmoOverwrite
  629.       CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "MSACM.imaadpcm", "imaadpcm.acm", cmoOverwrite
  630.       CreateIniKeyValue WinDir$ + "control.ini", "drivers.desc", "msacm.drv", "Microsoft Sound Mapper V2.00", cmoOverwrite
  631.       CreateIniKeyValue WinDir$ + "control.ini", "drivers.desc", "msadpcm.acm", "Microsoft ADPCM Codec V2.00", cmoOverwrite
  632.       CreateIniKeyValue WinDir$ + "control.ini", "drivers.desc", "imaadpcm.acm", "Microsoft IMA ADPCM Codec V2.00", cmoOverwrite
  633.  
  634.       CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "VIDC.DUCK", "trueduck.drv", cmoOverwrite
  635.  
  636.       ''
  637.       '' If a DCI provider card exists then set the ini files
  638.       '' ----------------------------------------------------
  639.       IF DCIProvider$ <> "" THEN
  640.          CreateIniKeyValue WinDir$ + "WIN.INI", "TrueMotion", "VideoHardware", "ON", cmoOverwrite
  641.          DCIProvider$ = ""
  642.       ELSE
  643.          CreateIniKeyValue WinDir$ + "WIN.INI", "TrueMotion", "VideoHardware", "OFF", cmoOverwrite
  644.       END IF
  645.  
  646.       Run ("regedit.exe /s " + MakePath(WinDir$, "mplayer.reg"))
  647.       Run ("regedit.exe /s " + MakePath(WinSysDir$, "OLE2.reg"))
  648.       Run ("regedit.exe /s " + MakePath(WinSysDir$, "cleanup.reg"))
  649.  
  650.       i% = DoMsgBox(ANALYZE_MSG, WINDOW_TITLE, MB_OK + MB_TASKMODAL + MB_ICONINFORMATION)
  651.  
  652.       ''
  653.       '' Profile the display for Video for Windows
  654.       '' -----------------------------------------
  655.       Run ("profdisp.exe")
  656.  
  657.       ''
  658.       '' Perform the WinG video profiling exercise
  659.       '' -----------------------------------------
  660.       Run ("profwing.exe")      
  661.  
  662.       ''
  663.       '' Change the VFW Skip flag to ON
  664.       '' ------------------------------
  665.       CreateIniKeyValue WinDir$ + "WIN.INI", "MCIAVI", "SkipFrames", "1", cmoOverwrite
  666.  
  667.    END IF
  668.  
  669.    EnableCtl3D 0
  670.  
  671.    SrcDir2$ = ""
  672.  
  673.    Install = INSTALLOK
  674.    EXIT FUNCTION
  675.  
  676. END FUNCTION
  677.  
  678.  
  679.  
  680. ''
  681. '' MakePath: Builds path from directory and file
  682. '' ---------------------------------------------
  683. FUNCTION MakePath (szDir$, szFile$) STATIC AS STRING
  684.  
  685.    IF szDir$ = "" THEN
  686.       MakePath = szFile$
  687.    ELSEIF szFile$ = "" THEN
  688.       MakePath = szDir$
  689.    ELSEIF MID$(szDir$, LEN(szDir$), 1) = "\" THEN
  690.       MakePath = szDir$ + szFile$
  691.    ELSE
  692.       MakePath = szDir$ + "\" + szFile$
  693.    END IF
  694.  
  695. END FUNCTION
  696.  
  697.  
  698.  
  699. ''
  700. '' Adds the specified option files to the copy list
  701. '' ------------------------------------------------
  702. SUB AddOptFilesToCopyList (Option%) STATIC
  703.  
  704.    SrcDir2$ = SrcDir$ + "\"
  705.  
  706.    ''
  707.    '' Clear the copy list
  708.    '' -------------------
  709.    ClearCopyList
  710.  
  711.    ''
  712.    '' Add the requested section to the copy list
  713.    '' ------------------------------------------
  714.    IF Option% = APP_CB THEN
  715.       AddSectionFilesToCopyList PROGRAM_SECT,    SrcDir2$, DstDir$
  716.       AddSectionFilesToCopyList DATABASE_SECT,   SrcDir2$, DstDir$
  717.       AddSectionFilesToCopyList BACKUP_SECT,     SrcDir2$, DstDir$
  718.       AddSectionFilesToCopyList MPLAYER_SECT,    SrcDir2$, WinDir$
  719.       AddSectionFilesToCopyList VFW_SECT,        SrcDir2$, WinSysDir$
  720.       AddSectionFilesToCopyList WING_SECT,       SrcDir2$, WinSysDir$
  721.       AddSectionFilesToCopyList TMS_SECT,        SrcDir2$, WinSysDir$
  722.    ELSEIF Option% = DEMO_CB THEN
  723.       AddSectionFilesToCopyList DEMO_SECT,       SrcDir2$, DstDir$
  724.    END IF
  725.  
  726.    SrcDir2$ = ""
  727.  
  728. END SUB
  729.  
  730.  
  731.  
  732. ''
  733. '' Enable/Disable Dialog box 3d look and feel
  734. '' ------------------------------------------
  735. SUB EnableCtl3D (Enable%) STATIC
  736.  
  737.    ''
  738.    '' Only enable 3d if not enabled already, and only disable 3d if
  739.    '' not disabled already.
  740.    '' -------------------------------------------------------------
  741.    IF Enable% <> EnableStatus% THEN
  742.       EnableStatus% = Enable%
  743.  
  744.       IF Enable% = 1 THEN
  745.          k% = ctl3dRegister (HinstFrame())
  746.          k% = ctl3dAutosubclass (HinstFrame())
  747.       ELSE
  748.          k% = Ctl3dUnregister (HinstFrame())
  749.       END IF
  750.    END IF
  751.       
  752. END SUB
  753.  
  754.  
  755.  
  756. ''
  757. '' Recalculates disk space for the given option files and sets
  758. '' the status info symbol "StatusItemsText".
  759. '' -----------------------------------------------------------
  760. SUB RecalcPath (Option%) STATIC
  761.  
  762.    CursorSave% = ShowWaitCursor()
  763.  
  764.    AddExtra% = 0
  765.    DriveNum% = ASC(ucase$(WinDrive$)) - ASC("A") + 1
  766.  
  767.    ''
  768.    '' Add the specified section files to the copy list
  769.    '' ------------------------------------------------
  770.    AddOptFilesToCopyList Option%
  771.  
  772.    ''
  773.    '' Set the List symbol depending on the section
  774.    '' --------------------------------------------
  775.    IF Option% = APP_CB THEN
  776.       ListSym$ = AppNeeds$
  777.                
  778.       ''
  779.       '' Add extra cost to Windows drive for ini/progman, etc
  780.       '' ----------------------------------------------------
  781.       ReplaceListItem ExtraCosts$, DriveNum%, "10240"
  782.       AddExtra% = 1
  783.    ELSEIF Option% = DEMO_CB THEN
  784.       ListSym$ = Opt2Needs$
  785.    END IF
  786.  
  787.    ''
  788.    '' Get required space for the current section
  789.    '' ------------------------------------------
  790.    StillNeed& = GetCopyListCost(ExtraCosts$, ListSym$, "")
  791.  
  792.    ''
  793.    '' Set the space required in the dialog text area, after adding
  794.    '' any necessary space needed by any drive.
  795.    '' ------------------------------------------------------------
  796.    SpaceNeeded& = 0
  797.    FOR j% = 3 TO 26 STEP 1
  798.       SpaceNeeded&  = SpaceNeeded& + VAL(GetListItem(ListSym$, j%))
  799.    NEXT j%
  800.  
  801.    ReplaceListItem STATUSTEXT$, Option%, STR$(SpaceNeeded& / 1024) + " K"
  802.  
  803.    IF AddExtra% THEN
  804.       ReplaceListItem ExtraCosts$, DriveNum%, "0"
  805.    END IF
  806.  
  807.    ListSym$ = ""
  808.  
  809.    RestoreCursor CursorSave%
  810.  
  811. END SUB
  812.  
  813.  
  814.  
  815.  
  816. ''
  817. '' Sets drive status info according to latest disk space calcs
  818. '' -----------------------------------------------------------
  819. SUB SetDriveStatus STATIC
  820.  
  821.    Drive$ = MID$(DstDir$, 1, 1)
  822.  
  823.    SpaceNeeded& = 0
  824.  
  825.    FOR Option% = 1 TO LAST_CB STEP 1
  826.       IF GetListItem(CHECKSTATES$, Option%) = "ON" THEN
  827.          SpaceNeeded&  = SpaceNeeded& + VAL(GetListItem(STATUSTEXT$, Option%))
  828.       END IF
  829.    NEXT Option%
  830.  
  831.    FreeSpace& = GetFreeSpaceForDrive(Drive$)
  832.  
  833.    ''
  834.    '' Set the dialog text to show the amount of free space and required
  835.    '' space.  DO NOT BE ALARMED if the required space changes when you
  836.    '' select different destination drives. The GetCopyListCost function
  837.    '' takes into account the Hard Disk Drive Cluster Size, and also it
  838.    '' adds an extra 16k to each list, for the Windows drive. 
  839.    '' ------------------------------------------------------------------
  840.    ReplaceListItem DRIVETEXT$, 1, Drive$ + ":"
  841.    ReplaceListItem DRIVETEXT$, 2, STR$(SpaceNeeded&) + " K"
  842.    ReplaceListItem DRIVETEXT$, 3, STR$(FreeSpace& / 1024) + " K"
  843.  
  844. END SUB
  845.